package com.onlineMIS.ORM.entity.chainS.batchRpt;

import com.onlineMIS.ORM.entity.chainS.user.ChainStore;
import com.onlineMIS.common.Common_util;
import com.onlineMIS.common.loggerLocal;


public class ChainCurrentSeasonSalesAnalysisItem {
	private int rank;
	private ChainStore chainStore;
	private double lastYearPurchase = 0;
	private int purchaseQ = 0;
	private double purchaseAmt = 0;
	private int returnQ = 0;
	private double returnAmt = 0;
	
	//父采购
	private int netPurchaseQ = 0;//净采购数量
	private double netPurchaseAmt = 0;//采购净采购金额
	private double returnRatio;//采购退货率
		
	//子采购
	private int purchaseQC = 0;
	private double purchaseAmtC = 0;
	private int returnQC = 0;
	private double returnAmtC = 0;
	private int netPurchaseQC = 0;
	private double netPurchaseAmtC = 0;
	private double returnRatioC;
	
	//父在途
	private int inDeliveryQ = 0;//未确认收获数量
	private double inDeliveryAmt = 0;//未确认收获金额
	private double inDeliveryRatio;//未确认收获金额占比
	
	//子在途
	private int inDeliveryQC = 0;//未确认收获数量
	private double inDeliveryAmtC = 0;//未确认收获金额
	private double inDeliveryRatioC;//未确认收获金额占比
	
	
	private int inventoryQ = 0;
	private double inventoryAmt = 0;
	private double inventoryRatio;
	private double salesQ = 0;
	private double salesCost = 0;
	private double salesAmt = 0;
	private double salesRatio;
	
	//上周销售
	private int lastWeekNum = 0;
	private double lastWeekCost = 0.0;
	private double lastWeekAmt = 0.0;
	private int lastWeekSum = 0;
	
	
	
	public ChainCurrentSeasonSalesAnalysisItem(){
		
	}
	
	public int getPurchaseQC() {
		return purchaseQC;
	}

	public void setPurchaseQC(int purchaseQC) {
		this.purchaseQC = purchaseQC;
	}

	public double getPurchaseAmtC() {
		return purchaseAmtC;
	}

	public void setPurchaseAmtC(double purchaseAmtC) {
		this.purchaseAmtC = purchaseAmtC;
	}

	public int getReturnQC() {
		return returnQC;
	}

	public void setReturnQC(int returnQC) {
		this.returnQC = returnQC;
	}

	public double getReturnAmtC() {
		return returnAmtC;
	}

	public void setReturnAmtC(double returnAmtC) {
		this.returnAmtC = returnAmtC;
	}

	public double getSalesCost() {
		return salesCost;
	}

	public void setSalesCost(double salesCost) {
		this.salesCost = salesCost;
	}

	public int getNetPurchaseQ() {
		return netPurchaseQ;
	}

	public void setNetPurchaseQ(int netPurchaseQ) {
		this.netPurchaseQ = netPurchaseQ;
	}

	public int getReturnQ() {
		return returnQ;
	}

	public void setReturnQ(int returnQ) {
		this.returnQ = returnQ;
	}

	public int getInDeliveryQ() {
		return inDeliveryQ;
	}

	public void setInDeliveryQ(int inDeliveryQ) {
		this.inDeliveryQ = inDeliveryQ;
	}

	public int getPurchaseQ() {
		return purchaseQ;
	}

	public void setPurchaseQ(int purchaseQ) {
		this.purchaseQ = purchaseQ;
	}

	public int getInventoryQ() {
		return inventoryQ;
	}

	public void setInventoryQ(int inventoryQ) {
		this.inventoryQ = inventoryQ;
	}

	public double getSalesQ() {
		return salesQ;
	}

	public void setSalesQ(double salesQ) {
		this.salesQ = salesQ;
	}

	public double getInDeliveryRatio() {
		return inDeliveryRatio;
	}

	public void setInDeliveryRatio(double inDeliveryRatio) {
		this.inDeliveryRatio = inDeliveryRatio;
	}

	public double getNetPurchaseAmt() {
		return netPurchaseAmt;
	}

	public void setNetPurchaseAmt(double netPurchaseAmt) {
		this.netPurchaseAmt = netPurchaseAmt;
	}

	public double getReturnAmt() {
		return returnAmt;
	}

	public void setReturnAmt(double returnAmt) {
		this.returnAmt = returnAmt;
	}

	public double getInDeliveryAmt() {
		return inDeliveryAmt;
	}

	public void setInDeliveryAmt(double inDeliveryAmt) {
		this.inDeliveryAmt = inDeliveryAmt;
	}

	public ChainCurrentSeasonSalesAnalysisItem(ChainStore store){
		this.chainStore = store;
	}
	
	public int getRank() {
		return rank;
	}
	public void setRank(int rank) {
		this.rank = rank;
	}
	public ChainStore getChainStore() {
		return chainStore;
	}
	public void setChainStore(ChainStore chainStore) {
		this.chainStore = chainStore;
	}
	public double getLastYearPurchase() {
		return lastYearPurchase;
	}
	public void setLastYearPurchase(double lastYearPurchase) {
		this.lastYearPurchase = lastYearPurchase;
	}
	public double getPurchaseAmt() {
		return purchaseAmt;
	}
	public void setPurchaseAmt(double purchaseAmt) {
		this.purchaseAmt = purchaseAmt;
	}
	public double getReturnRatio() {
		return returnRatio;
	}
	public void setReturnRatio(double returnRatio) {
		this.returnRatio = returnRatio;
	}
	public double getInventoryAmt() {
		return inventoryAmt;
	}
	public void setInventoryAmt(double inventoryAmt) {
		this.inventoryAmt = inventoryAmt;
	}
	public double getInventoryRatio() {
		return inventoryRatio;
	}
	public void setInventoryRatio(double inventoryRatio) {
		this.inventoryRatio = inventoryRatio;
	}
	public double getSalesAmt() {
		return salesAmt;
	}
	public void setSalesAmt(double salesAmt) {
		this.salesAmt = salesAmt;
	}
	public double getSalesRatio() {
		return salesRatio;
	}
	public void setSalesRatio(double salesRatio) {
		this.salesRatio = salesRatio;
	}
	

	public int getNetPurchaseQC() {
		return netPurchaseQC;
	}

	public void setNetPurchaseQC(int netPurchaseQC) {
		this.netPurchaseQC = netPurchaseQC;
	}

	public double getNetPurchaseAmtC() {
		return netPurchaseAmtC;
	}

	public void setNetPurchaseAmtC(double netPurchaseAmtC) {
		this.netPurchaseAmtC = netPurchaseAmtC;
	}

	public int getInDeliveryQC() {
		return inDeliveryQC;
	}

	public void setInDeliveryQC(int inDeliveryQC) {
		this.inDeliveryQC = inDeliveryQC;
	}

	public double getInDeliveryAmtC() {
		return inDeliveryAmtC;
	}

	public void setInDeliveryAmtC(double inDeliveryAmtC) {
		this.inDeliveryAmtC = inDeliveryAmtC;
	}

	public double getInDeliveryRatioC() {
		return inDeliveryRatioC;
	}

	public void setInDeliveryRatioC(double inDeliveryRatioC) {
		this.inDeliveryRatioC = inDeliveryRatioC;
	}

	public double getReturnRatioC() {
		return returnRatioC;
	}

	public void setReturnRatioC(double returnRatioC) {
		this.returnRatioC = returnRatioC;
	}
	
	

	public int getLastWeekNum() {
		return lastWeekNum;
	}

	public void setLastWeekNum(int lastWeekNum) {
		this.lastWeekNum = lastWeekNum;
	}

	public double getLastWeekCost() {
		return lastWeekCost;
	}

	public void setLastWeekCost(double lastWeekCost) {
		this.lastWeekCost = lastWeekCost;
	}

	public double getLastWeekAmt() {
		return lastWeekAmt;
	}

	public void setLastWeekAmt(double lastWeekAmt) {
		this.lastWeekAmt = lastWeekAmt;
	}

	public int getLastWeekSum() {
		return lastWeekSum;
	}

	public void setLastWeekSum(int lastWeekSum) {
		this.lastWeekSum = lastWeekSum;
	}

	public void calculateRatio() {
		netPurchaseAmt = purchaseAmt - returnAmt;
		netPurchaseQ = purchaseQ - returnQ;
		
		if (purchaseAmt == 0) {
			returnRatio = Common_util.ALL_RECORD;
		} else {
			returnRatio = returnAmt / purchaseAmt;
		}
		
		if (netPurchaseAmt == 0) {
			salesRatio = Common_util.ALL_RECORD;
			inventoryRatio = Common_util.ALL_RECORD;
			inDeliveryRatio = Common_util.ALL_RECORD;
		} else {
			salesRatio = salesAmt/ netPurchaseAmt;
			inventoryRatio = inventoryAmt / netPurchaseAmt;
			inDeliveryRatio = inDeliveryAmt / netPurchaseAmt;
		}	
		
		netPurchaseAmtC = purchaseAmtC - returnAmtC;
		netPurchaseQC = purchaseQC - returnQC;
		
        if (purchaseAmtC == 0) {
			returnRatioC = Common_util.ALL_RECORD;
		} else {
			returnRatioC = returnAmtC / purchaseAmtC;
		}
        
		if (netPurchaseAmtC == 0) {
			inDeliveryRatioC = Common_util.ALL_RECORD;
		} else {
			inDeliveryRatioC = inDeliveryAmtC / netPurchaseAmtC;
		}	
		try {
			loggerLocal.info("---- ChainCurrentSearson --- " + this.toString());
		} catch (Exception e) {
			// TODO: handle exception
		}
		
		
	}

	@Override
	public String toString() {
		return "ChainCurrentSeasonSalesAnalysisItem [chainStoreId=" + chainStore.getChain_id() + ", lastYearPurchase="
				+ lastYearPurchase + ", purchaseQ=" + purchaseQ + ", purchaseAmt=" + purchaseAmt + ", returnQ="
				+ returnQ + ", returnAmt=" + returnAmt + ", netPurchaseQ=" + netPurchaseQ + ", netPurchaseAmt="
				+ netPurchaseAmt + ", returnRatio=" + returnRatio + ", purchaseQC=" + purchaseQC + ", purchaseAmtC="
				+ purchaseAmtC + ", returnQC=" + returnQC + ", returnAmtC=" + returnAmtC + ", netPurchaseQC="
				+ netPurchaseQC + ", netPurchaseAmtC=" + netPurchaseAmtC + ", returnRatioC=" + returnRatioC
				+ ", inDeliveryQC=" + inDeliveryQC + ", inDeliveryAmtC=" + inDeliveryAmtC + ", inDeliveryRatioC="
				+ inDeliveryRatioC + ", inDeliveryQ=" + inDeliveryQ + ", inDeliveryAmt=" + inDeliveryAmt
				+ ", inDeliveryRatio=" + inDeliveryRatio + ", inventoryQ=" + inventoryQ + ", inventoryAmt="
				+ inventoryAmt + ", inventoryRatio=" + inventoryRatio + ", salesQ=" + salesQ + ", salesCost="
				+ salesCost + ", salesAmt=" + salesAmt + ", salesRatio=" + salesRatio + "]";
	}

	
	
	
}
